import 'package:flutter/material.dart';

// 自定义顶部 tab 样式
class CustomAppBarPage extends StatefulWidget {
  final Map arguments;
  CustomAppBarPage({Key key, this.arguments}) : super(key: key);

  @override
  _CustomAppBarPageState createState() => _CustomAppBarPageState();
}

class _CustomAppBarPageState extends State<CustomAppBarPage> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 3,
      child: Scaffold(
        appBar: AppBar(
          title: Text('CustomAppBarPage'),
          centerTitle: false,
          backgroundColor: Colors.blue,
          // leading: IconButton(
          //   icon: Icon(Icons.menu),
          //   onPressed: () {
          //     print('');
          //   },
          // ),
          actions: <Widget>[
            IconButton(
              icon: Icon(Icons.search),
              onPressed: () {
                print('');
              },
            ),
            IconButton(
              icon: Text('分享'),
              onPressed: () {
                print('');
              },
            ),
          ],
          bottom: TabBar(
            tabs: [
              Tab(
                text: '热门',
              ),
              Tab(
                text: '推荐',
              ),
              Tab(
                text: '本地',
              ),
            ],
          ),
        ),
        body: TabBarView(
          children: [
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab0_0')),
                ListTile(title: Text('tab0_1')),
                ListTile(title: Text('tab0_2')),
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab1_0')),
                ListTile(title: Text('tab1_1')),
                ListTile(title: Text('tab1_2')),
              ],
            ),
            ListView(
              children: <Widget>[
                ListTile(title: Text('tab2_0')),
                ListTile(title: Text('tab2_1')),
                ListTile(title: Text('tab2_2')),
              ],
            ),
          ],
        ),
      ),
    );
  }
}
